//1.0导入相关包
import Vue from 'vue'
import vueRouter from 'vue-router'
import vueResource from 'vue-resource'

//1.0.1导入相关组件
import App from './App.vue'
import Login from './components/Login.vue'
import Register from './components/Register.vue'
import vueRes from './components/vueresource.vue'

//2.0在vue中加载vueRouter vueResource
Vue.use(vueRouter);
Vue.use(vueResource); //使用vueResource 对象才能自动在Vue实例上挂载一个$http

//2.0.1在vue上注册一个全局过滤器名叫tolowercase   （全局过滤器定义）
Vue.filter('tolowercase',function(input,p){ //后面的p是参数，可写可不写
	return input.toLowerCase() + '-->from global';
});

//3.0定义路由规则对象
let router = new vueRouter({
	routes:[
		{name:'Login',path:'/Account/Login/:id/:name',component:Login},
		{name:'Register',path:'/Account/Register',component:Register},
		{name:'vueRes',path:'/vueRes',component:vueRes}
		
	]
});

//4.0使用router

new Vue({
	el:'#app',  //在index.html中有一个id为app的div
	router,
	render:c=>c(App)
});